/**
 * Copyright(c) 2025 hbswxx.com, All Rights Reserved. Author: kouqiang Create date: 2025/5/29
 */
package cn.sw.syncdata.service.impl;

import cn.sw.syncdata.entity.HeartInfo;
import cn.sw.syncdata.local.mapper.ILocalDataBaseHeaderMapper;
import cn.sw.syncdata.remote.mapper.IRemoteDataBaseHeaderMapper;
import cn.sw.syncdata.service.HeaderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

/**
 * description:
 *
 * @author kouqiang
 * @date 2025/5/29 13:10
 */
@Service
@Slf4j
public class HeaderServiceImpl implements HeaderService {

    @Resource
    IRemoteDataBaseHeaderMapper remoteDataBaseHeaderMapper;
    @Resource
    private ILocalDataBaseHeaderMapper localDataBaseHeaderMapper;

    @Override
    public List<HeartInfo> queryRemoteHeaderInfo(long lastId, int limit) {
      return remoteDataBaseHeaderMapper.queryHeaders(lastId, limit);
    }

    @Override
    public long insertLocalHeaderInfo(List<HeartInfo> heartInfos) {
      return localDataBaseHeaderMapper.insertDatas(heartInfos);
    }
}
